home *** CD-ROM | disk | FTP | other *** search
/ Programming a Multiplayer FPS in DirectX / Programming a Multiplayer FPS in DirectX (Companion CD).iso / DirectX / dxsdk_oct2004.exe / dxsdk.exe / Documentation / DirectX9 / directplay.chm / code / vsmetadata.js < prev    next >
Encoding:
JavaScript  |  2004-09-27  |  1.1 KB  |  52 lines

  1. // return an instance of the Visual Studio metadata helper object
  2. function EnsureVSMetadata(oTopic, oCtx)
  3. {
  4.     if (!EnsureVSMetadata._oVSHelper)
  5.     {
  6.         EnsureVSMetadata._oVSHelper = new VSMetadata(oDoc, oCtx);
  7.     }
  8.  
  9.     return EnsureVSMetadata._oVSHelper;
  10. }
  11.  
  12. function VSMetadata(oCtx)
  13. {
  14.     this._oCtx = oCtx;
  15.     this._oRegRef = new RegExp("(ref|const|struct|iface|isv_element|enum|function|object|method|pi|property|attribute|pseudo_class|pseudo_element|declaration|rule|event|collection|behavior|srcdisp|class|dhfilter|dhfilter_property|winmsg|dhcmdid)");
  16. }
  17.  
  18. VSMetadata.prototype.GetTopicType = function()
  19. {
  20.     var oDoc = this._oCtx.GetDocument();
  21.     if (!oDoc)
  22.     {
  23.         return "";
  24.     }
  25.     
  26.     var oMD = oDoc.selectSingleNode("/inetsdk:topic/metadata");
  27.     if (!oMD)
  28.     {
  29.         return "";
  30.     }
  31.  
  32.     var sType = oMD.getAttribute("type");
  33.     if (this._oRegRef.test(sType))
  34.     {
  35.         return "kbSyntax";
  36.     }
  37.     else if (sType == "howto")
  38.     {
  39.         return "kbHowTo";
  40.     }
  41.     else if (sType == "ovw")
  42.     {
  43.         return "kbOrient";
  44.     }
  45.     else
  46.     {
  47.         // BUGBUG: What's the catchall VS topictype?
  48.         return sType;
  49.     }
  50. }
  51.  
  52.